fixes bug in custom contracts