Another bug fix - altered placement of check