Fix the crash on refresh bug

Handles issue #14