fixed some issues which commented by Fernando