Fixed bug with extra padding element being added on 64-bit, which broke the return condition. Also implemented debug flag for printouts