fixed to small bugs introduced while merging