fix bugs in temp solution to #755