Code works on boot loader but not when directly programmed