Fixed a couble of bugs