Fixed bug found by Sid