Merged several changes from j1 to try and fix capacitive buttons