Fixed issues introduced by late night coding