Fixing strange behavior