Fixes bug for valueOf functionality for objects