Applying workarounds for HHVM compatibility
HHVM does not report memory usage with enough detail - fixes division by 0 cases