Default Phone not locking

The other day my phone started acting a bit odd as it is no longer getting locked when the screen is turned off. Normally it would lock itself after 30 minutes if I leave it untouched, and immediately if I click on the power button. Now when I turn the screen off it doesn't lock itself. Sometimes when I exit the camera or another app the phone locks itself. Also, the screen comes on at random times.

I haven't installed any new apps lately and have experienced this on Monxified and iHacker roms, so it doesn't appear to be rom specific. Is there any way to check what could be causing the non-locking and random screen on issues?