clean up zooming code and fix #386