Bug fixes to make it hardware compatible