Removed unneeded checks.
Fixed a bug.