Fix some nil/empty checks