Fixed some errors, ready to debug on metal