corrected minor bug. should work