Fixed cake function bug