Improve safety checks