Form is being displayed when it should not be