Better implementation of the bug fix