Fixed bug in temp. check