More safe way to check variables