fixed bad bugs with ugly fixes