Fix implementation of error
Handle dynamic window_size