Fixed a bug in the bug fix. Sigh.
Added verifications, fixed error