Fixed dangerous bug