Bug fixes.

FIXING BUGS