multiple fixes for button, workaround for possible bug in sqlite