added header, fixed bug