fixes for garbage or undefined results of operations